package com.ticket.sass.admin.controller;

import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ticket.sass.admin.business.UserBusiness;
import com.ticket.sass.admin.dto.input.user.UserListInput;
import com.ticket.sass.admin.dto.output.user.NewUserData;
import com.ticket.sass.admin.dto.output.user.UserListOutput;
import com.ticket.sass.admin.model.PageModel;
import com.ticket.sass.admin.model.ResultModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author ywb
 * @since 2024-03-06
 */
@RestController
@AllArgsConstructor
@ApiSupport(order = 4)
@Api(tags = {"用户数据-模块"})
@RequestMapping("/users")
public class UserController {
    final UserBusiness userBusiness;
    
    @ApiOperation("列表")
    @GetMapping
    public ResultModel<PageModel<UserListOutput>> list(
        @Valid UserListInput input
    ) {
        return ResultModel.success(
            userBusiness.getUser(input)
        );
    }
    
    
    @ApiOperation("新用户数据")
    @GetMapping("/new-user-data")
    public ResultModel<NewUserData> newUserData(
    ) {
        return ResultModel.success(
            userBusiness.newUserData()
        );
    }
}
